<%@ Page Title="Sys_Holiday Item" Language="C#" AutoEventWireup="true" CodeBehind="Sys_HolidayItem.aspx.cs" Inherits="Youz.CreditRepay.Manage.Sys_HolidayItem" %>

<script type="text/javascript">
    

    var requireJS = [
        //"assets/js/jquery.form.js",""
    ];
    loadJS(requireJS);

    $(function () {
        $('.form_date').datetimepicker({
            language: "zh_CN",
            format: "yyyy-mm-dd",
            autoclose: true,
            todayBtn: true,
            todayHighlight: true,
            pickerPosition: "bottom-left",
            startView: 2,
            minView: 2,
            forceParse: 0
        });
    });
</script>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h2><i class="fa fa-edit"></i><%: R(LanguageModule.Sys_Holiday, "Sys_Holiday", "Sys_Holiday") %></h2>
            </div>
            <div class="panel-body">
                <form id="frm" class="form-horizontal" method="post" enctype="multipart/form-data" action="Sys/Handlers/Sys_HolidayHandler.ashx?type=save">
                    <input id="HolidayID" name="HolidayID" type="hidden" />
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_Holiday, "HolidayTitle", "假日标题") %></label>
                        <div class="controls">
                            <input type="text" id="HolidayTitle" name="HolidayTitle" maxlength="200" class="form-control required" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_Holiday, "HolidayDate", "假日日期") %></label>
                        <div class="input-group date form_date">
                            <input id="HolidayDate" name="HolidayDate" class="form-control" size="16" type="text" readonly="readonly">
                            <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                            <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
                        </div>

                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_Holiday, "Status", "状态") %></label>
                        <div class="controls">
                            <select name="Status" id="Status" class="form-control required">
                                <option value="1" selected>启用</option>
                                <option value="2">禁用</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label" for="RoleDesc"><%: R(LanguageModule.Sys_Holiday, "Memo", "备注") %></label>
                        <div class="controls">
                            <textarea id="Memo" name="Memo" rows="3" maxlength="1000" class="form-control"></textarea>
                        </div>
                    </div>
                    <div class="alert alert-danger" style="display: none;">
                        <button type="button" class="close" data-dismiss="alert">×</button><strong>Oh snap!</strong><span class="content"></span>
                    </div>
                    <div class="form-actions">
                        <button class="btn btn-success" type="submit" id="btnSubmit"><%: R(LanguageModule.M_Common, "btnSubmit", "保存修改") %></button>
                        <button class="btn btn-default" type="button" id="btnCancel"><%: R(LanguageModule.M_Common, "btnCancel", "取消") %></button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    var flag = false;

    function validate() {
        return $("#frm").valid();
    };

    function get() {
        $.post("Sys/Handlers/Sys_HolidayHandler.ashx?type=get", { HolidayID: "<%= WebHelper.Get("HolidayID") %>" }, function (data) {
            $('#frm').fill(data);
        }, 'json');
    }

    $(function () {
        $("#frm").validate({
            errorElement: "span"
        });

        get();

        $("#frm").ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, $form, options) {
                if (flag) {
                    return false;
                }
                else {
                    flag = true;
                    return true;
                }
            },
            success: function (data) {
                if (data.isSuccess) {
                    loadPage("Sys/Sys_HolidayList.aspx");
                }
                else {
                    $(".alert > .content").html(data.message);
                    $(".alert").show();
                }
                flag = false;
            }
        });

        $("#btnCancel").click(function () {
            loadPage("Sys/Sys_HolidayList.aspx");
        });
    });

</script>
